package com.qiyu.jvm.oom;


import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 测试参数：-Xms20m -Xmx20m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/Users/linhao/IdeaProjects/2020-project/qiyu-tech/qiyu-Infrastructure/qiyu-Infrastructure/qiyu-jvm/src/main/java/com/qiyu/jvm/oom
 *
 * @Author idea
 * @Date created in 10:07 上午 2021/1/3
 */
public class HeapOOM {


    public static void main(String[] args) {
        List<HeapOOMExtraObj> list = new ArrayList<>();
        long i =0;
        while (true) {
            i++;
            System.out.println(i);
            HeapOOMExtraObj heapOOMExtraObj = new HeapOOMExtraObj();
            heapOOMExtraObj.setDate(new Date());
            heapOOMExtraObj.setId(1);
            heapOOMExtraObj.setUsername("idea");

            HeapOOMHelpObj heapOOMHelpObj = new HeapOOMHelpObj();
            heapOOMHelpObj.setHeapOOMExtraObj(heapOOMExtraObj);

            list.add(heapOOMExtraObj);
        }
    }
}
